<template>
	<view class="cancellation">
		<view class="">
			注销账号后,您将不能使用此账号登录APP
		</view>
		<view class="">
			您是否确认注销此账户?
		</view>

		<view class="fixView" style="height: 260rpx;"> </view>
		<view class="fixBtn" style="height: 260rpx;">
			<button @click="cancellation" style="color: #999;">注 销</button>
			<button style="margin-top: 40rpx;" @click="back" type="primary">再 想 想</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {}
			}
		},
		onLoad() {
			this.userInfo = uni.getStorageSync('userInfo')
		},
		methods: {
			back() {
				uni.navigateBack()
			},
			cancellation() {
				uni.showModal({
					title: '提示',
					content: '您确认要注销账号吗?',
					success: (val) => {
						if (val.confirm) {
							uni.showLoading()
							this.$http('post', '/Base_Manage/Base_User/Cancellation?userId=' + this.userInfo
								.Id).then(res => {
								uni.hideLoading()
								console.log(res);
								if (res.Success) {
									uni.removeStorageSync('token')
									uni.removeStorageSync('userInfo')
									uni.removeStorageSync('CompanyInfo')
									uni.removeStorageSync('pass')
									uni.reLaunch({
										url: '/pages/Login/Login'
									})
								} else this.$api.msg(res.Msg)
							})
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.cancellation {
		height: 100%;
		background-color: #fff;
		padding: 20rpx;
		padding-top: 100rpx;
		box-sizing: border-box;
		text-align: center;
		color: #666;
	}
</style>